function calcProfit() {
    let capital = parseFloat(document.getElementById("capital").value);
    let buy = parseFloat(document.getElementById("buyPrice").value);
    let sell = parseFloat(document.getElementById("sellPrice").value);
    let feeRate = 0.004; // 卖出手续费0.4%

    let grams = capital / buy;
    let revenue = sell * grams * (1 - feeRate);
    let profit = revenue - capital;

    document.getElementById("result").innerText = "预计利润：" + profit.toFixed(2) + " 元";
}